package com.queue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * @author yijy
 * @description
 * @create 2021/4/1 下午2:55
 **/
public class MainTest {

    public static void main(String[] args) {
        MessageQueue messageQueue = new MessageQueue<>(100);
        Thread provider = new Thread(()->{
            while (true) {
                messageQueue.offer("1");
            }
        });
        provider.start();
        Thread consumer = new Thread(()->{
            while (true) {
                messageQueue.take();
            }
        });
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        consumer.start();
        ArrayBlockingQueue queue = new ArrayBlockingQueue(10);
        queue.offer("1");

        LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue(10);
        linkedBlockingQueue.offer("1");
    }
}
